<?php

/**
 * 日志
 * @author root
 *
 */
class fx_log{
	
	private static $buffer;
	/**
	 * 写日志
	 * @param 级别 $level 日志记录级别LOG_EMERG,LOG_ALERT,LOG_CRIT,LOG_ERR,LOG_WARNING,LOG_NOTICE,LOG_INFO,LOG_DEBUG
	 * @param string $title
	 * @param string $message
	 */
	public static function write($level,$title,$message){
		if(HRLOO_DEBUG === 1){
			$buffer[]= $level.' | '.$title.' | '.$message.'<br/>'."\n";
		}
		if($level >= HLOG_LEVEL){
			//todo liaozc:write log here
		}
	}
	
	/**
	 * 写调试日志
	 * @param string $title
	 * @param string $message
	 */
	public static function debug($title,$message=''){
		self::write(LOG_DEBUG, $title, $message);
	}
	
	/**
	 * 将缓冲区中的日志ECHO
	 */
	public static function echo_log(){
		if(self::$buffer)
		{
			foreach(self::$buffer as $k => $log){
				echo $k,':',$log;
			}
		}
	}
}